﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="card_add.aspx.cs" Inherits="WebSite.admin.product.card_add" %>

 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>上海万礼通网络科技后台管理系统</title>
    <link href="../main.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        parent.maintitle.innerHTML = "礼品卡管理";
        parent.contentmain.innerHTML = "<span class='title01'>所在位置：</span>添加礼品卡。"

        function checkForm() {

            var cardPrice = document.getElementById("cardprice");
            var endTime = document.getElementById("endtime");
            var lastTime = document.getElementById("lasttime");
            var cardType = document.getElementById('<%=ddlCardType.ClientID %>');
            var cardCount = document.getElementById("txtCardCount");
            var oBeforNumber = document.getElementById("befornumber");
            var oAfterNumber = document.getElementById("afternumber");
            if (cardPrice.value == "") {
                alert("礼品卡面值不能为空!")
                cardPrice.focus();
                return false;
            } else if (isNaN(cardPrice.value) || cardPrice.value <= 0 || parseFloat(cardPrice.value) % 1 != 0) {
                alert("礼品卡面值必须是大于0的整数!")
                cardPrice.focus();
                return false;
            } else if (isNaN(oBeforNumber.value) || oBeforNumber.value <= 0 || parseFloat(oBeforNumber.value) % 1 != 0) {
                alert("礼品卡前面数字必须是大于0的整数!")
                oBeforNumber.focus();
                return false;
            }
             else if (isNaN(oAfterNumber.value) || oAfterNumber.value <= 0 || parseFloat(oAfterNumber.value) % 1 != 0) {
                alert("礼品卡后面位数必须是大于0的整数!")
                oAfterNumber.focus();
                return false;
            }
             else if (endTime.value == "") {
                alert("专区截止日期不能为空!");
                endTime.focus();
                return false;
            }
            else if (lastTime.value == "") {
                alert("礼品商城截止日期!");
                lastTime.focus();
                return false;
            } else if (cardType.value == "") {
                alert("卡片类别不能为空!");
                cardType.focus();
                return false;
            }
            else if (cardCount.value == "") {
                alert("卡片数量不能为空!");
                cardCount.focus();
                return false;
            } else if (isNaN(cardCount.value) || cardCount.value <= 0 || parseFloat(cardCount.value) % 1 != 0) {
                alert("卡片数量必须是大于0的整数!")
                cardCount.focus();
                return false;
            }
           

        
        }
    </script>

    <style type="text/css">
        #company
        {
            width: 80px;
        }
    </style>

</head>
<body>
    <form id="form1" runat="server">
    <div>
 <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F1F4F7">
<tr>
<td height="382" align="center" valign="top">
  <br />


      <table width="90%" border="0" cellpadding="5" cellspacing="0">
       <tr>
          <td align="right" width="20%">礼品卡面值</td>
          <td><input name="cardprice" type="text" id="cardprice"  runat="server" value="0" style="width: 80px" /><br />即购买人需要花费的实际金额</td>
        </tr>

       <tr>
          <td align="right" width="20%">卡片规则</td>
          <td>前面数字<input name="befornumber" type="text" id="befornumber"  runat="server" 
                  value="" style="width: 80px" maxlength="10" /> 后面位数<input 
                  name="afternumber" type="text" id="afternumber"  runat="server" value="5" 
                  style="width: 68px" maxlength="1" /><br />
              礼品卡由自定义前面数字+后面按输入的位数自动生成</td>
        </tr>
        <tr>
          <td align="right">专区开始日期</td>
          <td><input name="txtSartTime" type="text" id="txtSartTime" 
                  style="behavior:url('../../LWDP2.HTC'); width: 80px;" runat="server" /></td>
        </tr>
        <tr>
          <td align="right">专区截止日期</td>
          <td><input name="endtime" type="text" id="endtime"  
                  style="behavior:url('../../LWDP.HTC'); width: 80px;" runat="server" /><br />购买人必须在此日期前使用，否则自动失效</td>
        </tr>
     
        <tr>
          <td align="right">礼品商城截止日期</td>
          <td><input name="lasttime" type="text" id="lasttime"  
                  style="behavior:url('../../LWDP.HTC'); width: 80px;" runat="server" /></td>
        </tr>
     
        <tr>
          <td align="right">礼品卡类别</td>
          <td>
              <asp:DropDownList ID="ddlCardType" runat="server">
              </asp:DropDownList>
            </td>
        </tr>
     
         <tr>
          <td align="right">数量</td>
          <td>
          <input name="txtCardCount" type="text" id="txtCardCount"  runat="server" value="0" style="width: 80px" />
          </td>
        </tr>
        <tr>
          <td align="right">经销商</td>
          <td>
              <asp:DropDownList ID="ddlCompany" runat="server">
              </asp:DropDownList>
            </td>
        </tr>
        <tr>
          <td align="right">&nbsp;</td>
          <td>

             <asp:ImageButton ID="btnGenerate"  OnClientClick="return checkForm();" ImageUrl="../images/btnGenerateCard.gif" runat="server" OnClick="ibtnGenerate_Click" />

            </td>
        </tr>
        <tr>
          <td align="center" colspan="2">
  <asp:GridView ID="GridView1" runat="server" Width="90%" CellPadding="4" ForeColor="#333333" 
                  AutoGenerateColumns="False" pagesize="100" BorderStyle="Solid" 
                  BorderWidth="1px" 
      ShowFooter="false" EmptyDataText="没有数据记录！！" >
        <Columns>
           <asp:BoundField HeaderText="卡 号" DataField="cardcode" />
               <asp:BoundField HeaderText="礼品卡类别" DataField="CardTypeName" />
        <asp:BoundField HeaderText="金 额" DataField="cardprice"  />
          <asp:TemplateField HeaderText="专区开始日期">
          <ItemStyle Width="100px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}",Eval("starttime"))%>
        </ItemTemplate>
           </asp:TemplateField>
        <asp:TemplateField HeaderText="专区截止日期">
        <ItemStyle Width="100px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}",Eval("endtime"))%>
        </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="礼品商城截止日期">
        <ItemStyle Width="110px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}", Eval("lasttime"))%>
        </ItemTemplate>
        </asp:TemplateField>
       
        </Columns>
             <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />             
             <PagerStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Center" Font-Bold="True" Font-Size=30px />
             <HeaderStyle BackColor="#E2E7EB" Font-Bold="True" ForeColor="Black" HorizontalAlign="Left" />
             <AlternatingRowStyle BackColor="White" />
             <PagerSettings Visible="False" />
        </asp:GridView>
            </td>
        </tr>
      </table>
      
  <table width="90%" border="0" cellpadding="5" cellspacing="0">
  <tr>
      <td align="center"  colspan="2" >

                   <asp:ImageButton ID="btnAdd"  Visible="false" ImageUrl="../images/btnGenerateCard.gif" runat="server" OnClick="ibtnAdd_Click" />

      &nbsp;
       <asp:ImageButton ID="btnExport"  Visible="false" ImageUrl="../images/btnExportExcel.gif" runat="server" OnClick="ibtnExport_Click" />

     
</td>
      </tr>
   </table>
  </td>
</tr>
</table>
    </div>
    </form>
</body>
</html>
